package org.marsdonne.auth.resolver;

import graphql.kickstart.tools.GraphQLResolver;
import org.marsdonne.auth.EndPointUser;
import org.marsdonne.auth.EndPointUserRepos;
import org.marsdonne.auth.UnionUser;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class UnionUserGenericsResolver implements GraphQLResolver<UnionUser> {

    @Resource
    private EndPointUserRepos repos;

    public List<EndPointUser> getEndPointUsers(UnionUser unionUser) {
        return this.repos.findAllByUnionUser(unionUser);
    }
}
